package com.xm.servlet.background.orders;

import com.google.gson.Gson;
import com.xm.service.background.WarehouseService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 推荐选择的货源
 * @author 康文程
 * @date 2024-1-11
 */
@WebServlet("/background/recommend/select/warehouse")
public class RecommendSelectWarehouseServlet extends HttpServlet {
    private final WarehouseService warehouseService = new WarehouseService();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String warehouseId = req.getParameter("warehouseId");
        resp.setContentType("text/html;charset=utf-8");
        resp.getWriter().print(new Gson().toJson(warehouseService.getWarehouseById(Integer.parseInt(warehouseId))));
    }
}
